﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace ly.Web.QianTai
{
    /// <summary>
    /// InsertComment 的摘要说明
    /// </summary>
    public class InsertComment : IHttpHandler
    {
        ly.BLL.WorkInfo discussBll = new BLL.WorkInfo();
        ly.Model.disCuss disModel = new Model.disCuss();
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            var response = context.Response;
            var request = context.Request;
            //string workid = Request["workid"];
            //int id = Convert.ToInt32(workid);
            string name = request["name"];
            string content = request["content"];
            string time = request["time"];
            disModel.Username = name;
            disModel.Content = content;
            //jiang_Db newdb = new jiang_Db();
            try
            {
                discussBll.AdddisCuss(disModel);

                //newdb.ExecSql_None(string.Format("insert into comment([name],[content],[uptime]) values('{0}','{1}','{2}')", name, content, time));
                response.Write("success");
            }
            catch (Exception)
            {
                response.Write("error");
            }  
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}